<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
  <style>
    .layui-upload-img{
      width: 100px;
    }
    .layui-form-item .layui-input-inline{
      width: 500px;
    }
  </style>
</head>
<body>
<div style="margin-top: 20px;">
</div>

<form class="layui-form" id="article">
  <div class="layui-form-item">
    <label class="layui-form-label">名称</label>
    <div class="layui-input-inline" style="position: relative">
      <input name="name" id="artchname" value="{notempty name='$poi'}{$poi.name}{/notempty}" readonly lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" type="text">
      <div class="addressbox"></div>
    </div>
  </div>


  <div class="layui-form-item">
    <label class="layui-form-label">联系方式</label>
    <div class="layui-input-block" style="max-width: 500px">
      <textarea placeholder="请输入内容" class="layui-textarea" readonly name="mobile">{notempty name='$poi'}{$poi.mobile}{/notempty}</textarea>
    </div>
  </div>



  <div class="layui-form-item">
    <label class="layui-form-label">来源</label>
    <div class="layui-input-inline">
      <input name="source"  value="{notempty name='$poi'}{$poi.source}{/notempty}" readonly placeholder="请输入" autocomplete="off" class="layui-input" type="text">
    </div>
  </div>



  <div class="layui-form-item">
    <label class="layui-form-label">基本信息</label>
    <div class="layui-input-block" style="max-width: 500px">
      <textarea placeholder="请输入内容" class="layui-textarea" name="content" readonly>{notempty name='$poi'}{$poi.content}{/notempty}</textarea>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">预定方式和流程</label>
    <div class="layui-input-block" style="max-width: 500px">
      <textarea placeholder="请输入内容" class="layui-textarea" name="comment" readonly>{notempty name='$poi'}{$poi.comment}{/notempty}</textarea>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">结算信息</label>
    <div class="layui-input-block" style="max-width: 500px">
      <textarea placeholder="请输入内容" class="layui-textarea" name="introduce" readonly>{notempty name='$poi'}{$poi.introduce}{/notempty}</textarea>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">备注</label>
    <div class="layui-input-block" style="max-width: 500px">
      <textarea placeholder="请输入内容" class="layui-textarea" name="remark" readonly>{notempty name='$poi'}{$poi.remark}{/notempty}</textarea>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">特别说明</label>
    <div class="layui-input-block" style="max-width: 500px">
      <textarea placeholder="请输入内容" class="layui-textarea" name="description" readonly>{notempty name='$poi'}{$poi.description}{/notempty}</textarea>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">文件名称</label>
    <div class="layui-input-inline">
      <input name="fileid" id="fileid" value="{notempty name='$poi'}{$poi.filename}{/notempty}" placeholder="请输入" autocomplete="off" class="layui-input" type="text" readonly>
    </div>
    </div>


</form>


<script src="__PUBLIC__/layui/layui.js"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>

<script>
  layui.use('upload', function(){
    var upload = layui.upload;
    //执行实例
    upload.render({
      elem: '#uploadfile'
      ,url: "{:url('common/upload')}"
      ,accept: 'file' //普通文件
      ,done: function(res){
        layer.closeAll('loading')
        if(res.code == 2) {
            layer.msg("文件上传成功");
            $("#uploadname").html("更改文件");
          $("#fileid").val(res.id);
        } else {
          layer.msg(res.msg);
        }
      }
      ,error:function(){
          layer.closeAll('loading');
        }
      ,before:function () {
            layer.load(2)
        }

    });


  });
</script>
<script>
  layui.use(['layer', 'form'], function() {
    var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form;
    $(window).on('load', function() {
      form.on('submit(article)', function(data) {
        $.ajax({
          url:"{:url('admin/poi/addpoi')}",
          data:$('#article').serialize(),
          type:'post',
          async: false,
          success:function(res) {
            layer.msg(res.msg);
            if(res.code == 1) {
              setTimeout(function(){
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭
              },1500)
            }
          }
        })
        return false;
      });

    });
  });
</script>
</body>
</html>
